package com.rao.controller;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.rao.config.websecurity.permitcollect.PermitAnyOne;
import com.rao.core.startcollect.StartPrintUrlTag;
import com.rao.entity.VO.CommonResponseVO;
import com.rao.entity.VO.ScoreVO;
import com.rao.service.IScoreService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 分数表 前端控制器
 * </p>
 *
 * @author rao3030
 * @since 2021-11-04
 */
@RestController
@RequestMapping("/score")
@Api(value = "学生分数操作")
public class ScoreController {
    @Autowired
    IScoreService iScoreService;

    /*
     * {
     *   "endExamDate": "2021-11-05 00:00:11",
     *   "startExamDate": "2021-11-04 00:00:11",
     *   "studentName": "学生003-1"
     * }
     */
    @PermitAnyOne
    @StartPrintUrlTag
    @ApiOperation(value = "根据学生姓名+考试时间段查找成绩单")
    @RequestMapping(path = "/getByStuNameAndExamDate", method = RequestMethod.POST)
    public CommonResponseVO getByStuNameAndExamDate(@RequestBody @Valid ScoreVO scoreVO) {
        return CommonResponseVO.success(iScoreService.getByStuTime(scoreVO.getStudentName(), scoreVO.getStartExamDate(), scoreVO.getEndExamDate()));
    }
}
